import mongoose,{Schema,Document} from 'mongoose';

export interface ISliderDocument extends Document{
    url:  string;
    _doc: ISliderDocument;
}

const SliderSchema:Schema<ISliderDocument>=new Schema({
    url: String,
},{
    timestamps:true,
    toJSON: {
        transform: (_doc:any,result:any,options: any)=>{
            result.id= result._id,
            delete result._id;
            delete result.__v;
            delete result.createdAt;
            delete result.updatedAt;
            return result;
        }
    }
});

export const Slider=mongoose.model<ISliderDocument>("Slider",SliderSchema,"sliders");